Page({
    data: {
        // 定义轮播图图片资源
        img:[
            '../../imgs/b1.jpg',
            '../../imgs/b2.jpg',
            '../../imgs/b3.jpg',
            '../../imgs/b4.jpg',
            '../../imgs/b5.jpg'
        ],
        list:[]
    },
    tocat(e){
       console.log(e);
       let {id,title}=e.currentTarget.dataset.item
       
       wx.navigateTo({
         url: `../cat/cat?id=${id}&title=${title}`
       })
    },
    onLoad(options){
        console.log(options.item);
        let {classifyId,classify} = JSON.parse(options.item)
        wx.setNavigationBarTitle({
          title: classify,
        }),
        wx.request({
            url: 'https://route.showapi.com/1700-2?showapi_appid=1367085&showapi_sign=cb8507c33e4a43cfa34a954c91b91fd6',
            method:'GET',
            data:{classifyId},
            header:{'content-type':'application/json'},
            success:(res)=>{
               console.log(res);
               this.setData({
                list:res.data.showapi_res_body.contentlist
               })
              
            },
            fail:(err)=>{
                console.log(err);
            }
    
          })
    }

   
})